/**
 * Created by liuyun19 on 2018/12/26.
 */
import request from '@/service';

function obj2params(obj) {
  var params = "?";
  if(Object.prototype.toString.call(obj) === '[object Object]') {
    Object.keys(obj).forEach(item => {
      params += `${item}=${obj[item]}&`
    });
  }
  return params;
}

/* ########首页########## */
// 募集物资和爱心数量接口
const collectDonateCount = () => {
  return request(`${location.protocol}//${serverDomain}/info/progress`)
};
/* ########全部项目########## */
// 项目列表接口
const fetchProjectList = (obj) => {
  console.log('api 33333----->', obj)
  // return request(`${location.protocol}//${serverDomain}/projectList/get${obj2params(obj)}`)
  return request(`${location.protocol}//${serverDomain}/projectList/get`, obj)
}

export default {
  collectDonateCount,
  fetchProjectList,
}
